package org.ens.delegation.bo;

import java.util.List;
import javax.persistence.*;

/**
 * @author amine
 *
 */
@Entity
@Table(name="region")
public class Region implements IBusinessObject<Integer>{

	private Integer id;
	private String descriptionAr;
	private String descriptionFr;
	private List<Commune> listCommune;
	
	@Override
	@Id
	@Column(name="code_reg")
	public Integer getId() {
		return id;
	}

	@Override
	public void setId(Integer pk) {
		id = pk;
	}

	@Column(name="desciption_ar")
	public String getDescriptionAr() {
		return descriptionAr;
	}

	public void setDescriptionAr(String descriptionAr) {
		this.descriptionAr = descriptionAr;
	}

	@Column(name="desciption_fr")
	public String getDescriptionFr() {
		return descriptionFr;
	}

	public void setDescriptionFr(String descriptionFr) {
		this.descriptionFr = descriptionFr;
	}

	@OneToMany(mappedBy="region")
	public List<Commune> getListCommune() {
		return listCommune;
	}

	public void setListCommune(List<Commune> listCommune) {
		this.listCommune = listCommune;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(obj == null || !(obj instanceof Region))
			return false;
		Region region = (Region) obj;
		if(region.getId() == null)
			return false;
	
		return region.getId().equals(this.getId());
	}
	
	
}
